"""
 使用面向对象思想，描述以下场景：
    玩家（攻击力）攻击敌人（血量），敌人受伤（掉血），还可能死亡。
    敌人（攻击力）攻击玩家，玩家（血量）受伤（掉血、碎屏）。还可能死亡。
"""

class Enemy:
    def __init__(self, name, blood, atk):
        self.name = name
        self.blood = blood
        self.atk = atk
      
    @property
    def name(self):
        return self.__name
    @name.setter
    def name(self, name):
        self.__name = name
    
    @property
    def blood(self):
        return self.__blood
    @blood.setter
    def blood(self, blood):
        self.__blood = blood
    
    @property
    def atk(self):
        return self.__atk
    @atk.setter
    def atk(self, atk):
        self.__atk = atk
    
    # 攻击 
    def attack(self, shui):
        shui.shoushang(self.__atk)
        
    # 受伤
    def battack(self, attacks):
        self.blood -= attacks
        if self.__blood == 0:
            self.__siwang()

    def __siwang(self):
        print("玩家死亡！")
        print("碎屏效果")
    
    
class Game:
    def __init__(self, name, blood, atk):
        self.name = name
        self.blood = blood
        self.atk = atk
      
    @property
    def name(self):
        return self.__names
    @name.setter
    def name(self, name):
        self.__name = name
    
    @property
    def blood(self):
        return self.__blood
    @blood.setter
    def blood(self, blood):
        self.__blood = blood
    
    @property
    def atk(self):
        return self.__atk
    @atk.setter
    def atk(self, atk):
        self.__atk = atk
    
    # 攻击
    def goji(self, name):
        name.battack(self.__atk)
    
    # 受伤
    def shoushang(self, satk):
        self.__blood -= satk
        if self.__blood == 0:
            self.__siwang()

    def __siwang(self):
        print("以死亡！")
        print("掉装备！")
        print("加分")


zs = Enemy('张三', 100, 100)
ls = Game('李四', 100, 100)
zs.attack(ls)
print(ls.__dict__)

ls.goji(zs)
print(zs.__dict__)

